package com.common.intface;

import java.util.List;
import java.util.Map;

import org.hibernate.criterion.Criterion;

public interface IBaseDAO<T> {

    T save(T entity);
    
    void delete(T entity);

    T update(T entity);

    T find(int id);

    List<T> findAll();
    
    List<T> findByCriteria(Criterion... criterion);
    
    Long totalNumber();

    /**
     * @param startPos
     * @param amount
     * @param conditions
     * @param sortableProperty
     * @param asc
     */
    List<T> listAndSort(int startPos, int amount,
            Map<String, String> conditions, String sortableProperty, boolean asc);

}